package com.dnjn.mes.biz.domain;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.dnjn.mes.biz.enums.MaintainType;
import com.dnjn.mes.common.annotation.Excel;
import com.dnjn.mes.common.core.domain.BaseEntity;
import lombok.Getter;
import lombok.Setter;
import org.apache.ibatis.type.JdbcType;
import org.springframework.lang.NonNull;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.math.BigDecimal;
import java.time.LocalDateTime;

/**
 * <p>
 * 工件 零部件
 * </p>
 *
 * @author Amber
 * @since 2023-07-27
 */
@Getter
@Setter
@TableName("mes_workpiece")
public class MesWorkpiece extends BaseEntity {

    private static final long serialVersionUID = 1L;

    /**
     * PK
     */

    @TableId(value = "workpiece_id", type = IdType.ASSIGN_ID)
    private Long workpieceId;
    //@Excel(name = "名称")
    @Excel(name = "零部件名称")
    @NotBlank(message = "零部件名称不能为空")
    private String workpieceName;

    @Excel(name = "机器名")
    @TableField(exist = false)
    private String equipmentName;

    @Excel(name = "模块名")
    @TableField(exist = false)
    private String assemblyName;

    private String workpieceNamePinyin;
    /**数量*/
    @Excel(name = "数量")
    private Integer quantity;
    /**
     * 规格型号
     */
    @Excel(name = "规格型号")
    @NotBlank(message = "规格型号不能为空")
    private String workpieceNo;

    //@Excel(name = "图片名称")
    @Excel(name = "图片路径")
    @NotBlank(message = "图片名称不能为空")
    private String workpieceImage;
    /**
     * 维护保养周期(时)|寿命
     */
    @Excel(name = "寿命（H）")
    @NotNull(message = "寿命不能为空")
    private Integer maintainDuration;


    /**
     * 按运行时间0,按正常时1
     */
    @Excel(name = "是否根据运行时间倒计时")
    private String maintainType;

    @Excel(name = "提醒保养时间百分比(%)")
    @NotNull(message = "提醒保养时间百分比不能为空")
    private Integer remindPct;
    /**
     * 提醒信息
     */
    @Excel(name = "提醒保养提示信息")
    @NotBlank(message = "提醒保养提示信息不能为空")
    private String remindMessage;
    @Excel(name = "警告保养时间百分比(%)")
    @NotNull(message = "警告保养时间百分比不能为空")
    private Integer warningPct;
    /**
     * 警告信息
     */
    @Excel(name = "警告保养提示信息")
    @NotBlank(message = "警告保养提示信息不能为空")
    private String warningMessage;


    /**
     * 维护步骤url
     */
    @Excel(name = "维护保养步骤")
    @NotBlank(message = "维护保养步骤不能为空")
    private String maintainStepUrl;

    /**
     * 最近维护时间
     */
    private LocalDateTime lastMaintainTime;

    /**
     * 下次维护时间？
     */
    private LocalDateTime nextMaintainTime;

    /**
     * 耗时H
     */
    private BigDecimal timeSpent;

    private Integer ordinal;

    @NotNull(message = "模块id不能为空")
    private Long assemblyId;

    private String deleted;
    /**/
    @TableField(exist = false)
    private MesAssembly assembly;

    /**
     * 警告状态 2-正常;1-提醒;0-警告
     */
    @TableField(exist = false)
    private Integer status;

    private Long equipmentId;
}
